package com.gu.mobileweb.controller;


import com.gu.mobileweb.config.PageResult;
import com.gu.mobileweb.model.IndexEatBottom;
import com.gu.mobileweb.model.RespBean;
import com.gu.mobileweb.service.IndexEatBottomService;
import com.gu.mobileweb.service.IndexEatService;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.transform.Result;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author GSQ
 * @since 2020-12-07
 */
@RestController
@RequestMapping("/home/eat/bottom")
public class IndexEatBottomController {
    @Autowired
    private IndexEatBottomService indexEatBottomService;

//    @GetMapping("/all")
//    public List<IndexEatBottom> all() {
//        return indexEatBottomService.list();
//    }
    @GetMapping("/all")
    public RespBean allList(@RequestParam Map<Object, String> params){

        PageResult<IndexEatBottom> page = indexEatBottomService.allList(params);
        System.out.println("page---->"+page);
        if (page.getTotal() == 0){
            return RespBean.ok("查询内容为空");
        }
        return RespBean.ok("查询成功",page);
    }
}
